/**
 * 全局公共样式
 * 包含常用的样式类和工具类
 */

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 布局工具类 */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
}

/* 间距工具类 */
.m-0 { margin: 0; }
.m-10 { margin: 10rpx; }
.m-20 { margin: 20rpx; }
.m-30 { margin: 30rpx; }
.m-40 { margin: 40rpx; }

.mt-0 { margin-top: 0; }
.mt-10 { margin-top: 10rpx; }
.mt-20 { margin-top: 20rpx; }
.mt-30 { margin-top: 30rpx; }
.mt-40 { margin-top: 40rpx; }

.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10rpx; }
.mb-20 { margin-bottom: 20rpx; }
.mb-30 { margin-bottom: 30rpx; }
.mb-40 { margin-bottom: 40rpx; }

.ml-0 { margin-left: 0; }
.ml-10 { margin-left: 10rpx; }
.ml-20 { margin-left: 20rpx; }
.ml-30 { margin-left: 30rpx; }
.ml-40 { margin-left: 40rpx; }

.mr-0 { margin-right: 0; }
.mr-10 { margin-right: 10rpx; }
.mr-20 { margin-right: 20rpx; }
.mr-30 { margin-right: 30rpx; }
.mr-40 { margin-right: 40rpx; }

.p-0 { padding: 0; }
.p-10 { padding: 10rpx; }
.p-20 { padding: 20rpx; }
.p-30 { padding: 30rpx; }
.p-40 { padding: 40rpx; }

.pt-0 { padding-top: 0; }
.pt-10 { padding-top: 10rpx; }
.pt-20 { padding-top: 20rpx; }
.pt-30 { padding-top: 30rpx; }
.pt-40 { padding-top: 40rpx; }

.pb-0 { padding-bottom: 0; }
.pb-10 { padding-bottom: 10rpx; }
.pb-20 { padding-bottom: 20rpx; }
.pb-30 { padding-bottom: 30rpx; }
.pb-40 { padding-bottom: 40rpx; }

.pl-0 { padding-left: 0; }
.pl-10 { padding-left: 10rpx; }
.pl-20 { padding-left: 20rpx; }
.pl-30 { padding-left: 30rpx; }
.pl-40 { padding-left: 40rpx; }

.pr-0 { padding-right: 0; }
.pr-10 { padding-right: 10rpx; }
.pr-20 { padding-right: 20rpx; }
.pr-30 { padding-right: 30rpx; }
.pr-40 { padding-right: 40rpx; }

/* 文字工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: 20rpx; }
.text-sm { font-size: 24rpx; }
.text-base { font-size: 28rpx; }
.text-lg { font-size: 32rpx; }
.text-xl { font-size: 36rpx; }
.text-2xl { font-size: 40rpx; }
.text-3xl { font-size: 48rpx; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-primary { color: #667eea; }
.text-success { color: #52c41a; }
.text-warning { color: #faad14; }
.text-error { color: #ff4d4f; }
.text-info { color: #1890ff; }
.text-muted { color: #999; }

/* 背景工具类 */
.bg-primary { background-color: #667eea; }
.bg-success { background-color: #52c41a; }
.bg-warning { background-color: #faad14; }
.bg-error { background-color: #ff4d4f; }
.bg-info { background-color: #1890ff; }
.bg-white { background-color: #fff; }
.bg-gray { background-color: #f5f5f5; }

/* 边框工具类 */
.border { border: 1rpx solid #e5e5e5; }
.border-t { border-top: 1rpx solid #e5e5e5; }
.border-b { border-bottom: 1rpx solid #e5e5e5; }
.border-l { border-left: 1rpx solid #e5e5e5; }
.border-r { border-right: 1rpx solid #e5e5e5; }

.rounded { border-radius: 10rpx; }
.rounded-lg { border-radius: 20rpx; }
.rounded-full { border-radius: 50%; }

/* 阴影工具类 */
.shadow-sm { box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1); }
.shadow { box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1); }

/* 溢出工具类 */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }

/* 定位工具类 */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

/* 隐藏工具类 */
.hidden { display: none; }
.invisible { visibility: hidden; }

/* 动画工具类 */
.transition { transition: all 0.3s ease; }
.transition-fast { transition: all 0.15s ease; }
.transition-slow { transition: all 0.5s ease; }

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 20rpx 40rpx;
  border-radius: 50rpx;
  font-size: 28rpx;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.btn-primary:active {
  opacity: 0.8;
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1rpx solid #e5e5e5;
}

.btn-secondary:active {
  background: #e5e5e5;
}

.btn-success {
  background: #52c41a;
  color: #fff;
}

.btn-warning {
  background: #faad14;
  color: #fff;
}

.btn-error {
  background: #ff4d4f;
  color: #fff;
}

.btn-disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

/* 卡片样式 */
.card {
  background: #fff;
  border-radius: 20rpx;
  padding: 30rpx;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
}

/* 加载状态 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40rpx;
  color: #999;
}

.loading-spinner {
  width: 40rpx;
  height: 40rpx;
  border: 4rpx solid #f3f3f3;
  border-top: 4rpx solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80rpx 40rpx;
  color: #999;
}

.empty-icon {
  font-size: 80rpx;
  margin-bottom: 20rpx;
}

.empty-text {
  font-size: 28rpx;
  margin-bottom: 20rpx;
}

/* 分割线 */
.divider {
  height: 1rpx;
  background: #e5e5e5;
  margin: 20rpx 0;
}

/* 徽章样式 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4rpx 12rpx;
  border-radius: 20rpx;
  font-size: 20rpx;
  min-width: 40rpx;
  height: 32rpx;
}

.badge-primary {
  background: #667eea;
  color: #fff;
}

.badge-success {
  background: #52c41a;
  color: #fff;
}

.badge-warning {
  background: #faad14;
  color: #fff;
}

.badge-error {
  background: #ff4d4f;
  color: #fff;
}

/* 标签样式 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 8rpx 16rpx;
  border-radius: 20rpx;
  font-size: 22rpx;
}

.tag-primary {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
  border: 1rpx solid rgba(102, 126, 234, 0.3);
}

.tag-success {
  background: rgba(82, 196, 26, 0.1);
  color: #52c41a;
  border: 1rpx solid rgba(82, 196, 26, 0.3);
}

.tag-warning {
  background: rgba(250, 173, 20, 0.1);
  color: #faad14;
  border: 1rpx solid rgba(250, 173, 20, 0.3);
}

.tag-error {
  background: rgba(255, 77, 79, 0.1);
  color: #ff4d4f;
  border: 1rpx solid rgba(255, 77, 79, 0.3);
}